<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="org.apache.catalina.Session"%>
<%@ page import="java.sql.Date,java.sql.*"%>
<%@ page import="cn.ticket.db.DBConnect"%>
<%@ page import="cn.ticket.util.StringUtil"%>
<%@ page import="cn.ticket.Constant"%>
    <%
    request.setCharacterEncoding("utf8" ) ;
    String busId= request.getParameter("id") ;
	String userId= (String)session.getAttribute("login_user_id") ;

 if(null==busId || "".equals(busId)){
		session.setAttribute("errorinfo", Constant.ERRORINFO_NETERROR) ;
		%>
		<jsp:forward page="../front/result.jsp" />
		<%
	}	if(null==userId || "".equals(userId)){
			session.setAttribute("errorinfo", "用户"+Constant.ERRORINFO_PARAMETERNULL) ;		
		%>
		<jsp:forward page="../front/result.jsp" />
		<%
	}
	Connection con = new DBConnect().DBConnection() ;
	PreparedStatement pstmt=null ;
	try {
		String sql="update  bus set delSign="+Constant.DEL_SIGN_DELETED+" where id='"+busId+"'" ;
		pstmt =  con.prepareStatement(sql) ;
		System.out.println("sql is "+sql+ " result is "+pstmt.executeUpdate() ) ;
	 %>
		<jsp:forward page="busList.jsp?result=删除成功" />
		<%
	}catch(Exception e){
		session.setAttribute("errorinfo", Constant.ERRORINFO_NETERROR+e) ;		
		%>
		<jsp:forward page="../result.jsp" />
		<%
	}finally{
		pstmt.close();
		con.close() ;
	}
	
%>
